package com.fastCms.manager.bim.controller.api;


import com.fastCms.business.bim.manage.WeatherManageService;
import com.fastCms.business.bim.pojo.entity.Air;
import com.fastCms.business.bim.pojo.po.ChartPO;
import com.fastCms.business.bim.pojo.vo.AirVO;
import com.fastCms.business.bim.pojo.vo.WeatherVO;
import com.fastCms.business.frame.response.ApiResponse;
import com.fastCms.manager.frame.annotation.UserAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 天气 前端控制器
 * </p>
 *
 * @author liusq
 * @since 2021-03-05
 */
@RestController
@RequestMapping("api/weather")
@Api(value = "ApiWeatherController", tags = "前端-城市(省)天气空气接口")
@UserAccess
public class ApiWeatherController {

    @Autowired
    private WeatherManageService weatherManageServiceImpl;

    @ApiOperation(value = "当前城市(省份)空气质量", notes = "")
    @GetMapping("/getNowAir")
    public ApiResponse<AirVO> getNowAir() {
        ApiResponse<AirVO> nowAir = weatherManageServiceImpl.getNowAir();
        return nowAir;
    }


    @ApiOperation(value = "当前城市(省份)空气质量", notes = "")
    @PostMapping("/getHisAir")
    public ApiResponse<List<Air>> getHisAir(@RequestBody ChartPO chartPO) {
        ApiResponse<List<Air>> hisAir = weatherManageServiceImpl.getHisAir(chartPO);
        return hisAir;
    }

    @ApiOperation(value = "当前城市天气", notes = "")
    @GetMapping("/getNowWeather")
    public ApiResponse<WeatherVO> getNowWeather() {
        ApiResponse<WeatherVO> nowWeather = weatherManageServiceImpl.getNowWeather();
        return nowWeather;
    }

    @ApiOperation(value = "天气历史情况", notes = "")
    @GetMapping("/getNowWeatherHistory")
    public ApiResponse<WeatherVO> getNowWeatherHistory() {
        ApiResponse<WeatherVO> nowWeather = weatherManageServiceImpl.getNowWeatherHistory();
        return nowWeather;
    }

}
